//package com.macro.mall.demo.controller;
//
//
//import com.macro.mall.common.api.CommonResult;
//
//import com.macro.mall.model.PmsProductComment;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.util.Date;
//import java.util.List;
//
//@RestController
//public class PmsProductCommentController {
//    @Autowired
//    private PmsProductCommentService service;
//
//    /**
//     * 评论展示
//     */
//    @GetMapping("/commentList/{id}")
//    public CommonResult<PmsProductComment> commentList(@PathVariable Long id){
//        PmsProductComment pmsProductComment = new PmsProductComment();
//        //根据skuID查询 评论数量
//      Long count = service.commentCount(id);
//        pmsProductComment.setCount(count);
//        //商品 评级星级  todo 还需要一个用户id 没给
//        Integer uid = 11;
//        Long skuProductCount = service.skuProductLevel(id,uid);
//        System.out.println(skuProductCount);
//        pmsProductComment.setScore(skuProductCount);
//        //商品 评论内容 评论时间 评论人
//        List<PmsProductComment> list = service.PmsProductCommentList();
//
////        List<PmsProductComment> root = list.stream().filter(p -> p.getParentId().equals(0)).collect(Collectors.toList());
////        Map<Integer, List<PmsProductComment>> collect = list.stream().filter(p -> !p.getParentId().equals(0))
////                .collect(Collectors.groupingBy(PmsProductComment::getParentId));
////        list.stream().map(p->{
////            p.setChildren(collect.get(p.getParentId()));
////            return p;
////        }).collect(Collectors.toList());
//        pmsProductComment.setContent(list.get(0).getContent());
//        Date stateTime = list.get(0).getStateTime();
////        String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(stateTime);
////        System.out.println("时间是"+format);
//        pmsProductComment.setStateTime(list.get(0).getStateTime());
//
//        return CommonResult.success(pmsProductComment);
//    }
//
//
////    public UmsAdmin getCurrentAdmin() {
////        UserDto userDto = (UserDto) StpUtil.getSession().get(AuthConstant.STP_ADMIN_INFO);
////        UmsAdmin admin = adminCacheService.getAdmin(userDto.getId());
////        if (admin == null) {
////            admin = adminMapper.selectByPrimaryKey(userDto.getId());
////            adminCacheService.setAdmin(admin);
////        }
////        return admin;
////    }
//}
